package com.okilo.online.app.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import com.okilo.online.app.common.OkiloComDlog
import com.okilo.online.app.databinding.OkiloDlogApplySuccessBinding
import com.okilo.online.app.event.OkiloEventPointType

/**
 * OkiloLoan
 * @Author wwdeng
 * @CreateTime: 2024/11/13 15:41
 * @Annotation：提示dialog
 */
class OkiloApplySuccessDlog: OkiloComDlog {

    private lateinit var binding: OkiloDlogApplySuccessBinding
    private var callback: IOkiloApplySuccessClickCallback? = null

    constructor(context: Context) : super(context) {}
    constructor(context: Context, callback: IOkiloApplySuccessClickCallback?) : super(context) {
        this@OkiloApplySuccessDlog.callback = callback
    }

    constructor(context: Context, remark: String) : super(context) {
        dialogRemark = remark
    }
    constructor(context: Context, remark: String, callback: IOkiloApplySuccessClickCallback?) : super(context) {
        this@OkiloApplySuccessDlog.callback = callback
        dialogRemark = remark
    }

    override val dialogName: String = "Apply_Success"

    /**
     * 设置点击回调
     */
    fun setOnClick(callback: IOkiloApplySuccessClickCallback){
        this.callback = callback
    }

    override fun createOkiloContentView(): View {
        binding = OkiloDlogApplySuccessBinding.inflate(LayoutInflater.from(context))
        return binding.root
    }

    override fun initializeOkiloViews() {
        binding.okiloDlogApplySuccessTitle.setCustomFont("fonts/gilroy-black-6.otf")
    }

    override fun setupOkiloEventListeners() {
        setOnClickListener(binding.okiloButtonClose) //关闭
    }

    override fun loadOkiloData() {
    }

    override fun onOkiloEventViewClick(v: View?) {
        dismiss()
        addEventPointRequestAction(OkiloEventPointType.OKILO_CLICK_TRACK.LOAN_APPLY_SUCCESS_CLOSE,dialogRemark)
        callback?.onOkiloButtonCloseClick(v)
    }

    interface IOkiloApplySuccessClickCallback {
        fun onOkiloButtonCloseClick(view: View?)
    }
}